package com.group11.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.group11.resume.entity.EduBg;
import com.group11.resume.entity.WorkExp;
import com.group11.resume.mapper.WorkExpMapper;
import com.group11.resume.service.WorkExpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WorkExpServiceImpl implements WorkExpService {

    @Autowired
    private WorkExpMapper workExpMapper;

    public void addWorkExp(List<WorkExp> workExps) {
        workExpMapper.insert(workExps);
    }

    public List<WorkExp> listByResumeId(Integer resumeId) {
        LambdaQueryWrapper<WorkExp> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WorkExp::getResumeId, resumeId);
        return workExpMapper.selectList(queryWrapper);
    }

    public void deleteWorkExp(List<Integer> resumeIds) {
        workExpMapper.delete(new QueryWrapper<WorkExp>().in("resume_id", resumeIds));
    }
}
